package com.pl.service.impl;

import com.pl.entity.Repairurgency;
import com.pl.dao.RepairurgencyDao;
import com.pl.service.RepairurgencyService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
/**
 * (Repairurgency)表服务实现类
 *
 * @author makejava
 * @since 2024-05-04 20:51:49
 */
@Service("repairurgencyService")
public class RepairurgencyServiceImpl implements RepairurgencyService {
    @Autowired
    private RepairurgencyDao repairurgencyDao;

    /**
     * 通过ID查询单条数据
     *
     * @param repairurgencyId 主键
     * @return 实例对象
     */
    @Override
    public Repairurgency queryById(Integer repairurgencyId) {
        return this.repairurgencyDao.queryById(repairurgencyId);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<Repairurgency> queryByPage(Integer pageNum) {
        return this.repairurgencyDao.queryAllByLimit();
    }

    /**
     * 新增数据
     *
     * @param repairurgency 实例对象
     * @return 实例对象
     */
    @Override
    public Repairurgency insert(Repairurgency repairurgency) {
        this.repairurgencyDao.insert(repairurgency);
        return repairurgency;
    }

    /**
     * 修改数据
     *
     * @param repairurgency 实例对象
     * @return 实例对象
     */
    @Override
    public Repairurgency update(Repairurgency repairurgency) {
        this.repairurgencyDao.update(repairurgency);
        return this.queryById(repairurgency.getRepairurgencyId());
    }

    /**
     * 通过主键删除数据
     *
     * @param repairurgencyId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer repairurgencyId) {
        return this.repairurgencyDao.deleteById(repairurgencyId) > 0;
    }

    @Override
    public List<Repairurgency> findByMap(HashMap<String, Object> map) {
        return repairurgencyDao.findByMap(map);
    }

    @Override
    public int deleteByList(List<Integer> list) {
        return repairurgencyDao.deleteByList(list);
    }
}
